package com.acme.chat.message;

import java.sql.Timestamp;

/**
 * Class used to transmit private message info to save in the DB.
 */
public final class PrivateMessage {
    private String from;
    private String to;
    private String message;
    private long timestamp;

    public PrivateMessage(final String from, final String to, final long ts, final String message) {
        this.from = from;
        this.to = to;
        this.timestamp = ts;
        this.message = message;
    }

    public String getFrom() {
        return from;
    }

    public String getTo() {
        return to;
    }

    public String getMessage() {
        return message;
    }

    public Timestamp getTimestamp() {
        return new Timestamp(timestamp);
    }

    @Override
    public String toString() {
        return "PrivateMessage [from=" + from + ", to=" + to + ", message=" + message + ", timestamp=" + timestamp + "]";
    }
}
